package plus.easydo.easypush.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import plus.easydo.core.base.controller.BaseController;
import plus.easydo.core.result.R;
import plus.easydo.easypush.service.PushServer;

/**
 * @author laoyu
 * @version 1.0
 * @date 2022/2/26
 */
@RestController
@Api(tags = "推送接口")
@RequestMapping("/push")
public class PushController extends BaseController {

    @Autowired
    PushServer pushServer;

    @ApiOperation("推送简单文本消息")
    @RequestMapping("/{secret}")
    public R<Object> push(@PathVariable("secret") String secret, String channelId, String title, String text) throws Exception{
        return opResult(pushServer.push(secret,channelId,title,text));
    }
}
